package seesman.web;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;

import defiant.common.web.DefiantServlet;

/**
 * Servlet implementation class ConsoleServlet
 */
public class ConsoleServlet extends DefiantServlet {
	Logger log = Logger.getLogger(this.getClass());
	private static final long serialVersionUID = 134223423L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) 
		throws ServletException, IOException {
		try {
			Template t = Velocity.getTemplate("s/console.htm");
			VelocityContext ctx = getVelocityContext(request, response);
			
			// sample only
			ctx.put("user", "joseph acapulco");
						
			PrintWriter writer = response.getWriter();
			t.merge(ctx, writer);
			
		} catch (Exception e) {
			log.error(e);
		}
		
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		System.out.println("hello");
		
	}

}
